//
//  PersonalCell.m
//  Korea
//
//  Created by 崔剑 on 15/9/1.
//  Copyright (c) 2015年 KoreaGo. All rights reserved.
//

#import "PersonalCell.h"
#import "Header.h"

@implementation PersonalCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        self.headImageView = [[UIImageView alloc] init];
        self.headImageView.backgroundColor = [UIColor yellowColor];
        
        [self.contentView addSubview:self.headImageView];
        
        self.nameLabel = [[UILabel alloc] init];
        self.nameLabel.backgroundColor = [UIColor cyanColor];
        self.nameLabel.font = [UIFont boldSystemFontOfSize:17];
        [self.contentView addSubview:self.nameLabel];
        
        self.sexImageView = [[UIImageView alloc] init];
        self.sexImageView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:self.sexImageView];
        
        self.constellationLabel = [[UILabel alloc] init];
        self.constellationLabel.backgroundColor = [UIColor blueColor];
        self.constellationLabel.textColor = [UIColor colorWithRGB:0xf3f4f8 alpha:1];
        self.constellationLabel.font = [UIFont boldSystemFontOfSize:14];
        [self.contentView addSubview:self.constellationLabel];
        
        self.nextImage = [[UIImageView alloc] init];
        [self.nextImage setImage:[UIImage imageNamed:@"next@2x.png"]];
        [self.contentView addSubview:self.nextImage];
    }
    
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat width = self.contentView.frame.size.width;
    CGFloat height = self.contentView.frame.size.height;
    
    self.headImageView.frame = CGRectMake(width / 20, height / 6, height / 3 * 2, height / 3 * 2);
    self.headImageView.layer.cornerRadius = height / 3;
    self.headImageView.clipsToBounds = YES;
    self.nameLabel.frame = CGRectMake(width / 10 + height / 3 * 2, height / 6, width / 2, height / 3);
    self.sexImageView.frame = CGRectMake(width / 10 + height / 3 * 2, height / 2 + 5, height / 4, height / 4);
    self.constellationLabel.frame = CGRectMake(width / 10 + height / 3 * 2 + height / 4, height / 2 + 5, width / 3, height / 4);
    self.nextImage.frame = CGRectMake(340, (height - 25) / 2, 25, 25);
    
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
